package com.fjh.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.fjh.domain.BusRent;
import com.fjh.dto.RentDto;
import com.fjh.mapper.BusRentMapper;
import com.fjh.service.RentService;
import com.fjh.vo.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RentServiceImpl implements RentService {
    @Autowired
    private BusRentMapper rentMapper ;

    /**
     * 租车记录的查询
     *
     * @param rentDto
     * @return
     */
    @Override
    public PageInfo<BusRent> findByPage(RentDto rentDto) {
        Page<Object> pageData = PageHelper.startPage(rentDto.getPage(), rentDto.getLimit());
        List<BusRent> busRents = rentMapper.selectList(rentDto) ;
        return new PageInfo<>(pageData.getTotal(),busRents);
    }
}
